From: emellor@ewan Date: Wed, 21 Sep 2005 10:24:26 +0000 (+0100) Subject: On one of pyxc_domain_getinfo's error paths, free the block allocated X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16780^2~22 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7bfeb73ad774946e2cac1ad145c4e12fefeded94;p=xen.git On one of pyxc_domain_getinfo's error paths, free the block allocated previously. This would have caused a memory leak when attempting to get info on a domain that does not exist. Signed-off-by: Ewan Mellor --- diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index d7452fabd1..ef4c58d3e9 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -222,8 +222,11 @@ static PyObject *pyxc_domain_getinfo(PyObject *self, nr_doms = xc_domain_getinfo(xc->xc_handle, first_dom, max_doms, info); if (nr_doms < 0) + { + free(info); return PyErr_SetFromErrno(xc_error); - + } + list = PyList_New(nr_doms); for ( i = 0 ; i < nr_doms; i++ ) {